home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / Zoners Half-Life Tools / common / cmdlib.h < prev    next >
C/C++ Source or Header  |  2002-12-09  |  5KB  |  147 lines

  1. #ifndef CMDLIB_H__
  2. #define CMDLIB_H__
  3.  
  4. #if _MSC_VER >= 1000
  5. #pragma once
  6. #endif
  7.  
  8. #ifdef __MINGW32__
  9. #include <io.h>
  10. #endif
  11.  
  12. #ifdef HAVE_CONFIG_H
  13. #include "config.h"
  14. #endif
  15.  
  16. // AJM: gnu compiler fix
  17. #ifdef __GNUC__
  18. #define _alloca __builtin_alloca
  19. #define alloca __builtin_alloca
  20. #endif
  21.  
  22. #include "win32fix.h"
  23. #include "mathtypes.h"
  24.  
  25. //#define MODIFICATIONS_STRING "Submit detailed bug reports to (zoner@gearboxsoftware.com)\n"
  26. #define MODIFICATIONS_STRING "Submit detailed bug reports to (merlinis@bigpond.net.au)\n"
  27.  
  28. #ifdef _DEBUG
  29. #define ZHLT_VERSIONSTRING "v2.5.3 dbg"
  30. #else
  31. #define ZHLT_VERSIONSTRING "v2.5.3 rel"
  32. #endif
  33.  
  34. #define HACK_VERSIONSTRING "Custom Build 1.7"
  35.  
  36. //=====================================================================
  37. // AJM: Different features of the tools can be undefined here
  38. //      these are not officially beta tested, but seem to work okay
  39.  
  40. // ZHLT_* features are spread across more than one tool. Hence, changing
  41. //      one of these settings probably means recompiling the whole set
  42. #define ZHLT_INFO_COMPILE_PARAMETERS        // ALL TOOLS
  43. #define ZHLT_NULLTEX                        // HLCSG, HLBSP
  44. #define ZHLT_TEXLIGHT                       // HLCSG, HLRAD - triggerable texlights by LRC
  45. #define ZHLT_GENERAL                        // ALL TOOLS - general changes
  46. //#define ZHLT_DETAIL                         // HLCSG, HLBSP - detail brushes    
  47. //#define ZHLT_PROGRESSFILE                   // ALL TOOLS - estimate progress reporting to -progressfile
  48. //#define ZHLT_NSBOB
  49.  
  50. #define COMMON_HULLU // winding optimisations by hullu
  51.  
  52. // tool specific settings below only mean a recompile of the tool affected
  53. #define HLCSG_CLIPECONOMY
  54. #define HLCSG_WADCFG
  55. #define HLCSG_AUTOWAD
  56.  
  57. //#define HLBSP_THREADS // estimate for hlbsp
  58.  
  59. #define HLVIS_MAXDIST
  60.  
  61. #define HLRAD_INFO_TEXLIGHTS
  62. #define HLRAD_WHOME // encompases all of Adam Foster's changes
  63. #define HLRAD_HULLU // semi-opaque brush based entities and effects by hullu
  64.  
  65. //=====================================================================
  66.  
  67. #ifdef SYSTEM_WIN32
  68. #pragma warning(disable: 4127)                      // conditional expression is constant
  69. #pragma warning(disable: 4115)                      // named type definition in parentheses
  70. #pragma warning(disable: 4244)                      // conversion from 'type' to type', possible loss of data
  71. // AJM
  72. #pragma warning(disable: 4786)                      // identifier was truncated to '255' characters in the browser information
  73. #pragma warning(disable: 4305)                      // truncation from 'const double' to 'float'
  74. #pragma warning(disable: 4800)                     // forcing value to bool 'true' or 'false' (performance warning)
  75. #endif
  76.  
  77.  
  78. #ifdef STDC_HEADERS
  79. #include <stdio.h>
  80. #include <string.h>
  81. #include <stdlib.h>
  82. #include <errno.h>
  83. #include <ctype.h>
  84. #include <time.h>
  85. #include <stdarg.h>
  86. #include <limits.h>
  87. #endif
  88.  
  89. #ifdef HAVE_SYS_TIME_H
  90. #include <sys/time.h>
  91. #endif
  92. #ifdef HAVE_UNISTD_H
  93. #include <unistd.h>
  94. #endif
  95.  
  96. #ifdef ZHLT_NETVIS
  97. #include "c2cpp.h"
  98. #endif
  99.  
  100. #ifdef SYSTEM_WIN32
  101. #define SYSTEM_SLASH_CHAR  '\\'
  102. #define SYSTEM_SLASH_STR   "\\"
  103. #endif
  104. #ifdef SYSTEM_POSIX
  105. #define SYSTEM_SLASH_CHAR  '/'
  106. #define SYSTEM_SLASH_STR   "/"
  107. #endif
  108.  
  109. // the dec offsetof macro doesn't work very well...
  110. #define myoffsetof(type,identifier) ((size_t)&((type*)0)->identifier)
  111. #define sizeofElement(type,identifier) (sizeof((type*)0)->identifier)
  112.  
  113. #ifdef SYSTEM_POSIX
  114. extern char*    strupr(char* string);
  115. extern char*    strlwr(char* string);
  116. #endif
  117. extern const char* stristr(const char* const string, const char* const substring);
  118. extern bool CDECL safe_snprintf(char* const dest, const size_t count, const char* const args, ...);
  119. extern bool     safe_strncpy(char* const dest, const char* const src, const size_t count);
  120. extern bool     safe_strncat(char* const dest, const char* const src, const size_t count);
  121. extern bool     TerminatedString(const char* buffer, const int size);
  122.  
  123. extern char*    FlipSlashes(char* string);
  124.  
  125. extern double   I_FloatTime();
  126.  
  127. extern int      CheckParm(char* check);
  128.  
  129. extern void     DefaultExtension(char* path, const char* extension);
  130. extern void     DefaultPath(char* path, char* basepath);
  131. extern void     StripFilename(char* path);
  132. extern void     StripExtension(char* path);
  133.  
  134. extern void     ExtractFile(const char* const path, char* dest);
  135. extern void     ExtractFilePath(const char* const path, char* dest);
  136. extern void     ExtractFileBase(const char* const path, char* dest);
  137. extern void     ExtractFileExtension(const char* const path, char* dest);
  138.  
  139. extern short    BigShort(short l);
  140. extern short    LittleShort(short l);
  141. extern int      BigLong(int l);
  142. extern int      LittleLong(int l);
  143. extern float    BigFloat(float l);
  144. extern float    LittleFloat(float l);
  145.  
  146. #endif //CMDLIB_H__
  147.